﻿using System.Collections;
using UnityEngine;

public class DeathBringerIdleState : EnemyState
{
    private Enemy_DeathBringer enemy;
    private Transform player;
    public DeathBringerIdleState(EnemyStateMachine _stateMachine, Enemy _enemyBase, string _animBoolName, Enemy_DeathBringer _enemy) : base(_stateMachine, _enemyBase, _animBoolName)
    {
        this.enemy = _enemy;
    }

    public override void Enter()
    {
        base.Enter();

        stateTimer = enemy.idleTime;
        player = PlayerManager.instance.player.transform;
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();

        if(Vector2.Distance(player.position,enemy.transform.position) < 7)
            enemy.bossFirstBegun = true;

        if(stateTimer < 0 && enemy.bossFirstBegun)
        {
            AudioManager.instance.PlayBGM(1);
            stateMachine.ChangeState(enemy.BattleState);
        }
    }
}